#pragma once

#include "F:\dok\kode\libraries\glfw-2.7.2\include\GL\glfw.h"
#include <gl\GL.h>

#include <vector>
#include <iostream>
#include <string>
#include <cassert>



//GL_INVALID_ENUM: given when an enumeration parameter contains an enum that is not allowed for that function.
//GL_INVALID_VALUE: given when a numerical parameter does not conform to the range requirements that the function places upon it.
//GL_INVALID_OPERATION: given when the function in question cannot be executed because of state that has been set in the context.
//GL_STACK_OVERFLOW: given when a stack pushing operation causes a stack to overflow the limit of that stack's size.
//GL_STACK_UNDERFLOW: given when a stack popping operation is given when the stack is already at its lowest point.
//GL_OUT_OF_MEMORY: given when performing an operation that can allocate memory, when the memory in question cannot be allocated.
//GL_TABLE_TOO_LARGE (if the optional imaging subset (GL_ARB_imaging) is supported)
//GL_INVALID_FRAMEBUFFER_OPERATION 

// \breif Returns true on error
inline
bool checkGLErrors()
{
	bool retval = false;

	for ( GLenum Error = glGetError( ); ( GL_NO_ERROR != Error ); Error = glGetError( ) )
	{
		retval = true;

		switch ( Error )
		{
		case GL_INVALID_ENUM:      printf( "\n%s\n\n", "GL_INVALID_ENUM"      ); assert( 0 ); break;
		case GL_INVALID_VALUE:     printf( "\n%s\n\n", "GL_INVALID_VALUE"     ); assert( 0 ); break;
		case GL_INVALID_OPERATION: printf( "\n%s\n\n", "GL_INVALID_OPERATION" ); assert( 0 ); break;
		case GL_STACK_OVERFLOW:    printf( "\n%s\n\n", "GL_STACK_OVERFLOW"    ); assert( 0 ); break;
		case GL_STACK_UNDERFLOW:   printf( "\n%s\n\n", "GL_STACK_UNDERFLOW"   ); assert( 0 ); break;
		case GL_OUT_OF_MEMORY:     printf( "\n%s\n\n", "GL_OUT_OF_MEMORY"     ); assert( 0 ); break;
		case GL_TABLE_TOO_LARGE:     printf( "\n%s\n\n", "GL_TABLE_TOO_LARGE"     ); assert( 0 ); break;
		case GL_INVALID_FRAMEBUFFER_OPERATION:     printf( "\n%s\n\n", "GL_INVALID_FRAMEBUFFER_OPERATION"     ); assert( 0 ); break;

		default:                                                                              break;
		}
	}

	return retval;
}